//
//  ViewController.m
//  QJReceiveGuests
//
//  Created by hle1 on 2020/11/9.
//

#import "ViewController.h"
#import "QJWebViewController.h"


@interface ViewController ()
@property(nonatomic, strong) IBOutlet UITextView *textView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    @weakify(self);
    [[[NSNotificationCenter.defaultCenter rac_addObserverForName:UITextViewTextDidEndEditingNotification object:self.textView] map:^id _Nullable(NSNotification * _Nullable value) {
        return [value.object text];
    }] subscribeNext:^(NSString *  _Nullable x) {
        @strongify(self);
        NSString *url = x;
        NSLog(@"输入的URL：%@",x);
        QJWebViewController *vc = (QJWebViewController *)[QJWebViewController windowContainerWithUrl:url];
        [vc startLoad];
        [self.navigationController pushViewController:vc animated:YES];
    }];
    
}


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{

//    NSString *url = @"https://v2.brandpano.com/pano/IwbxIzYI";
//    NSString *url = @"widget://index.html";
    NSString *url = @"http://hladmin.brandpano.com/#/login";

    QJWebViewController *vc = (QJWebViewController *)[QJWebViewController windowContainerWithUrl:url];
    [vc startLoad];
    [self.navigationController pushViewController:vc animated:YES];
}


@end
